//
//  PushViewController.m
//  06-NavigationController
//
//  Created by 402030900@qq.com on 16/7/21.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "PushViewController.h"
#import "ViewController.h"

@interface PushViewController ()

@end

@implementation PushViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithRed:0.654 green:1.000 blue:0.904 alpha:1.000];
    UIButton * button = [UIButton buttonWithType:(UIButtonTypeSystem)];
    button.backgroundColor = [UIColor colorWithRed:1.000 green:0.531 blue:0.523 alpha:1.000];
    [button setFrame:CGRectMake(100, 100, 200, 200)];
    [button addTarget:self action:@selector(clickButton:)  forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:button];
    // Do any additional setup after loading the view.
}
-(void)clickButton:(UIButton *)button{
// POP 回到上一级
    [self.navigationController popViewControllerAnimated:YES];
    // 回到根视图
    [self.navigationController popToRootViewControllerAnimated:YES];
    // 回到指定视图控制器
    [self.navigationController popToViewController:[[ViewController alloc]init] animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
